import React, { useState, useEffect } from "react";
import ReactDOM from "react-dom";

function App() {
  let [num, setNum] = useState(0);
  let [name, setName] = useState("effect");

  useEffect(() => {
    console.log("num", num);
  }, [num]);
  
  return (
    <div>
      <p>
        {name}:{num}
      </p>
      <button onClick={() => setName("hello")}>change name</button>
      <button onClick={() => setNum(num + 1)}>+</button>
    </div>
  );
}
function render() {
  ReactDOM.render(<App />, document.getElementById("root"));
}
render();
